M
|
mumtaz 7/12/2010 |
I've tried the tricks that you provide to create the appropriate table to the one in the example. But I have not been able to prove what you write. The following table specification and function I was at phprunner. In this scenario, we have a TABLE called SALES_ORDER SO_ID is the primary key which generated automatically when each record inserted =================================================== SO_ID............PART_NUMBER......QTY =================================================== SO20100700001....PART1.............10 SO20100700002....PART2.............20 SO20100700003....PART3.............11 SO20100700004....PART4.............41 .................................... SO20100799999....PART8.............41 =================================================== SO : Custom string, you can replace with your own 2010 : current year 07 : current month (july) 000001-99999 : sequence number use phprunner Before record added event on the Events tab to calculate SO_ID: $sql="select max(substr(SO_ID,9)) as mx from SALES_ORDER where substr(SO_ID,7,2)=month(now()) order by mx";
|
romaldus author 7/13/2010 | |
mumtaz, |
M
|
mumtaz 7/18/2010 |
I've been using phprunner 5.2 (trial version) with mysql database. mumtaz, make sure you use the latest version of PHPrunner . In example above, i use MySQL 5 as the database. I haven't test it in other database.. |
romaldus author 7/19/2010 | |
I've been using phprunner 5.2 (trial version) with mysql database. its stil not running. Can u give me your db structure for this tutorial. maybe I was using the wrong table structure
CREATE TABLE IF NOT EXISTS `sales_order` (
|
M
|
mumtaz 7/19/2010 |
Romaldus |
M
|
mumtaz 8/6/2010 |
I have tried this trick. But when I try to change the year. Numbering continues to not generate from scratch. I use this script : $sql="select max(substr(SO_ID,9)) as mx from SALES_ORDER where substr(SO_ID,7,2)=month(now()) and substr(SO_ID,3,4)=year(now()) order by mx"; |
R
|
rjr003 8/8/2010 |
Hello, |
R
|
rjr003 8/8/2010 |
Hello, |
A
|
ashumak 8/29/2010 |
Hello, I have found the solution. I added an 'Alias' to the 'po_number' field on the query builder and the reference to the field changed accordingly. Regards. Ricardo
|
A
|
ashumak 8/29/2010 |
$sql="select max(substr(Heat,9)) as mx from customer_service_log where substr(Heat,7,2)=month(now()) order by mx";$rs=CustomQuery($sql);$data=db_fetch_array($rs);$str="HT";$str2=date("Ym");$str3=($data["mx"]+1);$values["Heat"]="$str$str2".str_pad($str3, 5, 0, STR_PAD_LEFT); |
A
|
Abul 1/30/2014 |
$sql="select max(substr(Heat,9)) as mx from customer_service_log where substr(Heat,7,2)=month(now()) order by mx";$rs=CustomQuery($sql);$data=db_fetch_array($rs);$str="HT";$str2=date("Ym");$str3=($data["mx"]+1);$values["Heat"]="$str$str2".str_pad($str3, 5, 0, STR_PAD_LEFT); This is what I used. While I get an email showing HT20100800001 as the Heat Ticket, the dtatbase is incresing the number up by one from 75, 76, 77, etc... and the email always shows the same as above...
|
emendoza 4/4/2014 | |
It works! |
romaldus author 7/28/2014 | |
hi, can someone translate this code to be use on ASPR 7.1? thanks.
|